import time
from Base.Base import Base
from selenium.webdriver.common.by import By
from Common.Api_client import ApiClient
class Page1_login(Base):
    def __init__(self,driver):
        super().__init__(driver)
        self.client=ApiClient()



    # 定位器
    # 定位元素操作的方法
    # 输入用户名


    def send_username(self, username):
        # 动态取 username_loc 配置
        by, value = self.client.get_locator("auth", "username_loc")
        self.send_keys((by, value), username)


    def send_password(self, password):
        # 动态取 password_loc 配置
        by, value = self.client.get_locator("auth", "password_loc")
        self.send_keys((by, value), password)

    # 点击登录按钮
    def click_login_btn(self):
        # 动态取 login_button_loc 配置
        by, value = self.client.get_locator("auth", "login_button_loc")
        self.click((by, value))
        # self.find_element((by, value)).click()

    # 获取点击登录按钮后上面的返回的内容
    def get_clickedlogin_text(self):
        by, value = self.client.get_locator("auth", "get_clickedlogin_loc")
        return self.get_location_text((by, value))

